package cn.kevinproject.dingtalk_robot.msg;

import com.dingtalk.api.request.OapiRobotSendRequest;
import lombok.*;

/**
 * @author kevin lau
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@Builder
public class MarkDownTextMessage extends AtTextMessage{

    private String title;

    public MarkDownTextMessage() {
        this.msgType = "markdown";
    }

    @Override
    public OapiRobotSendRequest buildRequest() {
        val request = super.buildRequest();
        val markdown = new OapiRobotSendRequest.Markdown();
        val at =  new OapiRobotSendRequest.At();
        at.setIsAtAll(getIsAttAll());
        at.setAtMobiles(getAtMobiles());
        markdown.setText(getText());
        markdown.setTitle(getTitle());
        request.setMarkdown(markdown);
        request.setAt(at);
        return request;
    }
}
